package com.oa.xinxi.dao;

import com.oa.xinxi.entity.Auth;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface AuthMapper {
    @Delete({
        "delete from auth",
        "where auth_id = #{authId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer authId);

    @Insert({
        "insert into auth (auth_id, auth_name)",
        "values (#{authId,jdbcType=INTEGER}, #{authName,jdbcType=VARCHAR})"
    })
    int insert(Auth record);

    @InsertProvider(type=AuthSqlProvider.class, method="insertSelective")
    int insertSelective(Auth record);

    @Select({
        "select",
        "auth_id, auth_name",
        "from auth",
        "where auth_id = #{authId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="auth_id", property="authId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="auth_name", property="authName", jdbcType=JdbcType.VARCHAR)
    })
    Auth selectByPrimaryKey(Integer authId);

    @UpdateProvider(type=AuthSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Auth record);

    @Update({
        "update auth",
        "set auth_name = #{authName,jdbcType=VARCHAR}",
        "where auth_id = #{authId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Auth record);
}